﻿using Newtonsoft.Json.Linq;

namespace Lg.Core.Form
{
    public interface IType
    {
        public string? Name { get; set; }
        public void Verify();

        /// <summary>
        /// 从当前类型对像的Value取值，特殊值进行格式化后返回
        /// </summary>
        /// <returns></returns>
        public FormData GetValue();
        /// <summary>
        /// 将原数据格式化为展示数据，封装成FormData添加至集合并反回
        /// 通过追加至集合的方式是为了解决组合类型的组件，含多个Name值的情况
        /// </summary>
        /// <param name="list">用于传递的数据集合</param>
        /// <param name="formData">原始json字符串转换后的对像</param>
        /// <returns></returns>
        public List<FormData> FormatValue(List<FormData>list,JObject formData);
        public FormData? SetValue(JObject formData);

        public string? FormatValue(string value);

        public void GetSaveDbValue(Dictionary<string, dynamic> formData,string inputValue);
    }
}
